package com.gxa.jjty.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.jjty.admin.mapper.ComplaintMapper;
import com.gxa.jjty.admin.service.ComplaintService;
import com.gxa.jjty.core.pojo.Complaint;
import com.gxa.jjty.core.service.impl.BaseServiceImpl;
import org.hibernate.validator.internal.metadata.aggregated.ValidatableParametersMetaData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @ClassName ComplaintServiceImpl
 * @Author: ws
 * @date 2021/12/17 10:27
 */
@Service(" complaintService")
public class ComplaintServiceImpl extends BaseServiceImpl<Complaint> implements ComplaintService {

    @Autowired
    private ComplaintMapper complaintMapper;

    @Override
    public PageInfo<Complaint> selectByPage(Integer page, Integer size) {
        PageHelper.startPage(page, size);

        Example example = new Example(Complaint.class);
        example.orderBy("createdTime").desc();

        List<Complaint> complaints = complaintMapper.selectByExample(example);

        return PageInfo.of(complaints);
    }
}
